package top.shen33.yang.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import top.shen33.yang.base.validator.FormValidator;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;

/**
 * <p>
 * 系统用户表
 * </p>
 *
 * @author oreilly
 * @since 2018-08-08
 */

@FormValidator
public class SysUser extends Model<SysUser> {

    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    @TableId(value = "sid", type = IdType.AUTO)
    private Integer sid;
    /**
     * 用户名
     */

    @NotBlank(message="用户名不能为空")
    private String sname;
    /**
     * 用户年龄
     */
//    @NotBlank(message="年龄不能为空")
//    @Pattern(regexp="^[0-9]{1,2}$",message="年龄不正确")
    private Integer age;
    private String type;
    /**
     * 自定义填充的创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date cdate;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date ctime;
    /**
     * 标识
     */
    private String scode;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date utime;
    /**
     * 出生日期
     */

    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate birthDate;
    /**
     * 备注
     */
    private String note;

    private String phone;

    @NotBlank(message = "email不能为空")
    @Email
    private String email;

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getSid() {
        return sid;
    }

    public void setSid(Integer sid) {
        this.sid = sid;
    }

    public String getSname() {
        return sname;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Date getCdate() {
        return cdate;
    }

    public void setCdate(Date cdate) {
        this.cdate = cdate;
    }

    public Date getCtime() {
        return ctime;
    }

    public void setCtime(Date ctime) {
        this.ctime = ctime;
    }

    public Date getUtime() {
        return utime;
    }

    public void setUtime(Date utime) {
        this.utime = utime;
    }

    public String getScode() {
        return scode;
    }

    public void setScode(String scode) {
        this.scode = scode;
    }


    public LocalDate getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(LocalDate birthDate) {
        this.birthDate = birthDate;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    protected Serializable pkVal() {
        return this.sid;
    }

    @Override
    public String toString() {
        return "SysUser{" +
        ", sid=" + sid +
        ", sname=" + sname +
        ", age=" + age +
        ", type=" + type +
        ", cdate=" + cdate +
        ", ctime=" + ctime +
        ", scode=" + scode +
        ", utime=" + utime +
        ", birthDate=" + birthDate +
        ", note=" + note +
        "}";
    }
}
